|
|
|
|
|
|
|
char EvtChar; // received event character
WORD wReserved1; // reserved; do not use
} |
|
|
|
|
|
|
|
|
Details on how different variable types are handled can be found in Tutorial 6, ''C++ Variables Meet Visual Basic." For now, all you need to know is that a "struct" in C++ will become a Visual Basic user-defined type and that a DWORD refers to a 32-bit Long variable. Look only at the first three fields in this C structure. |
|
|
|
|
|
|
|
|
The first is a 32-bit Long called DCBlength. |
|
|
|
|
|
|
|
|
The second is a 32-bit Long called BaudRate. |
|
|
|
|
|
|
|
|
The third is not a variable called fBinary. It is a 32-bit Long variable whose bits are defined as follows: |
|
|
|
|
|
|
|
|
Bit 0 is fBinary
Bit 1 is fParity
Bit 2 is fOutxCtsFlow
Bit 3 is fOutxDsrFlow
Bit 4 and 5 are fDtrControl
Bit 6 is fDsrSensitivity
Bit 7 is fTXContinueOnXoff
Bit 8 is fOutX
Bit 9 is fInX
Bit 10 is fErrorChar
Bit 11 is fNull
Bit 12 and 13 are fRtsControl
Bit 14 is fAbortOnError
Bit 1531 are not used |
|
|
|
|
|
|
|
|
The : (colon) character following the variable name indicates that the variable consists of a specified number of bits. Since Visual Basic does not support the concept of bitfields, all of these bits are combined together into a single 32-bit Long variable. A VB program needs to use Boolean operations to set, clear, and determine the value of individual bits. |
|
|
|
|
|
|
|
|
The actual DCB structure in Visual Basic is defined as shown here. All of the bit fields listed above are combined into the single "Bits1 " field. |
|
|
|
|
|
|
|
|
Type DCB
DCBlength As Long
BaudRate As Long
Bitsl As Long
wReserved As Integer
XonLim As Integer
XoffLim As Integer |
|
|
|
|
|